package com.qf.pojo;

import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.qf.config.MyJsonSeriaizee;
import org.springframework.format.annotation.DateTimeFormat;

import javax.sql.DataSource;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

/**
 * @author bss
 * @version V1.0
 * @Project maven
 * @Package com.qf.pojo
 * @Description:
 * @Date 2022/9/29 21:25
 */
@JsonInclude(JsonInclude.Include.NON_NULL) //null值 属性不输出
public class User {
    private Integer id;
    @JsonProperty("username")
    private String name;
    @JsonInclude(JsonInclude.Include.NON_EMPTY)// empty属性不输出( 空串，长度为0的集合，null值)
    private Character sex;
    @DateTimeFormat(pattern = "yyyy-mm-dd")
    @JsonFormat(pattern = "yyyy-mm-dd")
    private Date date;
//    @JsonIgnore 属性忽略
    private List<String> list;
    private String[] arr;
    @JsonSerialize(using = MyJsonSeriaizee.class)
    private double money;


    public double getMoney() {
        return money;
    }

    public void setMoney(double money) {
        this.money = money;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", sex=" + sex +
                ", date=" + date +
                ", list=" + list +
                ", arr=" + Arrays.toString(arr) +
                ", money=" + money +
                '}';
    }

    public List<String> getList() {
        return list;
    }

    public void setList(List<String> list) {
        this.list = list;
    }

    public String[] getArr() {
        return arr;
    }

    public void setArr(String[] arr) {
        this.arr = arr;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Character getSex() {
        return sex;
    }

    public void setSex(Character sex) {
        this.sex = sex;
    }
}
